const cloud = require('wx-server-sdk');

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database()

// 云函数入口函数
exports.main = async (event, context) => {
  const cloudIdList = event.cloudIdList

  try {
    const result = await cloud.getOpenData({
      list: cloudIdList
    })
    let phone = result.list[0].data.phoneNumber
    return{
      code: 200,
      data: phone
    }
  }
  catch (err) {
    console.error('transaction error')
    return {
      code: 201,
      msg: "获取失败！"
    }
  }
}
